-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decrease time-to-sync for learn-only devices joining the network #11271
Decrease time-to-sync for learn-only devices joining the network #11271
Conversation
Build Artifacts
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple things. Other than that looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
mock_enqueue.assert_called_once_with( | ||
job_id="9e89d3ea5256721c9cd631eac36feafe", | ||
args=(self.mock_broadcast.id, self.instance.to_dict()), | ||
args=(self.broadcast.id, self.instance.to_dict()), | ||
priority=mock_priority_method(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using mock_priority_method.return_value
can be a bit clearer for test assertions, and also as a practice avoids potential gotchas asserting the number of times a mock is called.
}, | ||
) | ||
|
||
self.broadcast = KolibriBroadcast(instance=self.broadcast_instance) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to keep using the mock, to keep the unit testing scope limited to the listeners. You can use spec
or spec_set
on the mock to constrain its usage to align with a particular class, in this case KolibriBroadcast
. All that said, the broadcast class doesn't do much without start_broadcast
called.
@bjester sir will keep in mind those suggestions for future test creations. Appreciate the detailed review sir, helps me improve ❤️ |
Summary
Decreases the time-to-sync for learn-only devices joining the network by playing with some task's priorities.
Developed together with @akolson ❤️
References
Closes #11220.
Reviewer guidance
Make sure the if condition is as specified in #11220.
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)